const router = require("koa-router")();
const fs = require("fs");

router.post("/getFileList", async (ctx, next) => {
  try {
      let path = `${__dirname.replace('\\','/').replace('/routes','')}/public/temporary`
      return ctx.body = fs
      .readdirSync("./")
      .filter(item => {
        let isFile = false;
        let _path = `./${item}`;
        return fs.statSync(_path).isFile();
      })
      .map(item => {
        let _path = `./${item}`;
        return  _path ;
      });
  } catch (error) {
    return ctx.body = `获取失败${error}`;
  }
});


}
